# coding:utf-8
import matplotlib.pyplot as plt
import matplotlib
matplotlib.use('qt4agg')
# 指定默认字体
matplotlib.rcParams['font.sans-serif'] = ['SimHei']
matplotlib.rcParams['font.family'] = ['sans-serif']
# 解决负号'-'显示为方块的问题
matplotlib.rcParams['axes.unicode_minus'] = False

x = [-3,-2,-1,0,1,2,3,4,5,6,7,8]
y = [9,4,1,0,1,4,9,16,25,36,49,64]

plt.plot(x,y,color='r',marker='o',linestyle='dashed')

# 定义坐标轴范围
plt.axis([-10,10,-20,100])

# 添加文本
plt.xlabel("x坐标轴")
plt.ylabel("y坐标轴")

# 添加注释
plt.annotate("y=x**2",xy=(3,11),xytext=(2,50),arrowprops=dict(facecolor='black',shrink=0.01))

plt.show()